Skip to contentSkip to conversation

Change in openvpn[master]: openvpnserv: Fix some inconsistent usages of TEXT()

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Jan 8, 2025 – Jan 27, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1736341120000.Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/851?usp=email

to review the following change.

Change subject: openvpnserv: Fix some inconsistent usages of TEXT()
......................................................................

openvpnserv: Fix some inconsistent usages of TEXT()

In general you can't use multiple strings as argument to TEXT() since it just adds a L in front of the argument. So if you specifiy multiple arguments the later argument strings do not get the L.

This does not seem to directly cause problems with our ASCII strings, but make the usage consistent with all the other code. That will help in case we remove the usage of TEXT().

Also include tapctl/basic.h in openvpnserv to make the macro environment consistent with tapctl and openvpnmsica.

Change-Id Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3

---
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/common.c
M src/openvpnserv/interactive.c
M src/openvpnserv/service.c
M src/openvpnserv/service.h

5 files changed, 13 insertions(+), 11 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/851/1

src/openvpnserv/CMakeLists.txt +1 -0
index 154e17c..ff03867 100644
@@ -17,6 +17,7 @@
     interactive.c
     service.c service.h
     validate.c validate.h
+    ../tapctl/basic.h
     ../openvpn/wfp_block.c ../openvpn/wfp_block.h
     openvpnserv_resources.rc
     ../openvpn/ring_buffer.h
src/openvpnserv/common.c +2 -2
index 61a7296..a88a724 100644
@@ -45,7 +45,7 @@
     if (status != ERROR_SUCCESS)
     {
         SetLastError(status);
-        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_instance, value);
+        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), service_instance, value);
     }
 
     return ERROR_SUCCESS;
@@ -63,7 +63,7 @@
     TCHAR install_path[MAX_PATH];
     TCHAR default_value[MAX_PATH];
 
-    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\" PACKAGE_NAME "%ls"), service_instance);
+    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls"), service_instance);
 
     LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ, &key);
     if (status != ERROR_SUCCESS)
src/openvpnserv/interactive.c +5 -5
index 67f5bbc..35753b7 100644
@@ -60,9 +60,9 @@
 
 openvpn_service_t interactive_service = {
     interactive,
-    TEXT(PACKAGE_NAME "ServiceInteractive"),
-    TEXT(PACKAGE_NAME " Interactive Service"),
-    TEXT(SERVICE_DEPENDENCIES),
+    TEXT(PACKAGE_NAME) TEXT("ServiceInteractive"),
+    TEXT(PACKAGE_NAME) TEXT(" Interactive Service"),
+    SERVICE_DEPENDENCIES,
     SERVICE_AUTO_START
 };
 
@@ -1973,7 +1973,7 @@
     }
 
     swprintf(ovpn_pipe_name, _countof(ovpn_pipe_name),
-             TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), service_instance, GetCurrentThreadId());
+             TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service_%lu"), service_instance, GetCurrentThreadId());
     ovpn_pipe = CreateNamedPipe(ovpn_pipe_name,
                                 PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
                                 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 1, 128, 128, 0, NULL);
@@ -2173,7 +2173,7 @@
     }
 
     TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */
-    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service"), service_instance);
+    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service"), service_instance);
     HANDLE pipe = CreateNamedPipe(pipe_name, flags,
                                   PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS,
                                   PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa);
src/openvpnserv/service.c +2 -2
index a71f5c6..054fc5f 100644
@@ -282,8 +282,8 @@
                 wprintf(TEXT("-instance interactive <id>\n")
                         TEXT("   Runs the service as an alternate instance.\n")
                         TEXT("   The service settings will be loaded from\n")
-                        TEXT("   HKLM\\Software\\" PACKAGE_NAME "<id> registry key, and the service will accept\n")
-                        TEXT("   requests on \\\\.\\pipe\\" PACKAGE "<id>\\service named pipe.\n"));
+                        TEXT("   HKLM\\Software\\") TEXT(PACKAGE_NAME) TEXT("<id> registry key, and the service will accept\n")
+                        TEXT("   requests on \\\\.\\pipe\\") TEXT(PACKAGE) TEXT("<id>\\service named pipe.\n"));
 
                 return 0;
             }
src/openvpnserv/service.h +3 -2
index 6b559a5..da20433 100644
@@ -37,9 +37,10 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <tchar.h>
+#include "../tapctl/basic.h"
 
-#define APPNAME  TEXT(PACKAGE "serv")
-#define SERVICE_DEPENDENCIES  TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"
+#define APPNAME  TEXT(PACKAGE) TEXT("serv")
+#define SERVICE_DEPENDENCIES  TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0")
 
 /*
  * Message handling

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/851?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3
Gerrit-Change-Number: 851
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/851?usp=email )

Change subject: openvpnserv: Fix some inconsistent usages of TEXT()
......................................................................

Patch Set 1: Code-Review+2

(1 comment)

Patchset:

PS1:
LGTM

Signature · 18 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/851?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3
Gerrit-Change-Number: 851
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 27 Jan 2025 09:08:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
#3 lore raw

PATCH 1/1 openvpnserv: Fix some inconsistent usages of TEXT()

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

In general you can't use multiple strings as argument to TEXT() since it just adds a L in front of the argument. So if you specifiy multiple arguments the later argument strings do not get the L.

This does not seem to directly cause problems with our ASCII strings, but make the usage consistent with all the other code. That will help in case we remove the usage of TEXT().

Also include tapctl/basic.h in openvpnserv to make the macro environment consistent with tapctl and openvpnmsica.

Change-Id Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/851
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Lev Stipakov <[email protected]...>

src/openvpnserv/CMakeLists.txt +1 -0
index 154e17c..ff03867 100644
@@ -17,6 +17,7 @@
     interactive.c
     service.c service.h
     validate.c validate.h
+    ../tapctl/basic.h
     ../openvpn/wfp_block.c ../openvpn/wfp_block.h
     openvpnserv_resources.rc
     ../openvpn/ring_buffer.h
src/openvpnserv/common.c +2 -2
index 61a7296..a88a724 100644
@@ -45,7 +45,7 @@
     if (status != ERROR_SUCCESS)
     {
         SetLastError(status);
-        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_instance, value);
+        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), service_instance, value);
     }
 
     return ERROR_SUCCESS;
@@ -63,7 +63,7 @@
     TCHAR install_path[MAX_PATH];
     TCHAR default_value[MAX_PATH];
 
-    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\" PACKAGE_NAME "%ls"), service_instance);
+    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls"), service_instance);
 
     LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ, &key);
     if (status != ERROR_SUCCESS)
src/openvpnserv/interactive.c +5 -5
index 67f5bbc..35753b7 100644
@@ -60,9 +60,9 @@
 
 openvpn_service_t interactive_service = {
     interactive,
-    TEXT(PACKAGE_NAME "ServiceInteractive"),
-    TEXT(PACKAGE_NAME " Interactive Service"),
-    TEXT(SERVICE_DEPENDENCIES),
+    TEXT(PACKAGE_NAME) TEXT("ServiceInteractive"),
+    TEXT(PACKAGE_NAME) TEXT(" Interactive Service"),
+    SERVICE_DEPENDENCIES,
     SERVICE_AUTO_START
 };
 
@@ -1973,7 +1973,7 @@
     }
 
     swprintf(ovpn_pipe_name, _countof(ovpn_pipe_name),
-             TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), service_instance, GetCurrentThreadId());
+             TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service_%lu"), service_instance, GetCurrentThreadId());
     ovpn_pipe = CreateNamedPipe(ovpn_pipe_name,
                                 PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
                                 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 1, 128, 128, 0, NULL);
@@ -2173,7 +2173,7 @@
     }
 
     TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */
-    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service"), service_instance);
+    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service"), service_instance);
     HANDLE pipe = CreateNamedPipe(pipe_name, flags,
                                   PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS,
                                   PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa);
src/openvpnserv/service.c +2 -2
index a71f5c6..054fc5f 100644
@@ -282,8 +282,8 @@
                 wprintf(TEXT("-instance interactive <id>\n")
                         TEXT("   Runs the service as an alternate instance.\n")
                         TEXT("   The service settings will be loaded from\n")
-                        TEXT("   HKLM\\Software\\" PACKAGE_NAME "<id> registry key, and the service will accept\n")
-                        TEXT("   requests on \\\\.\\pipe\\" PACKAGE "<id>\\service named pipe.\n"));
+                        TEXT("   HKLM\\Software\\") TEXT(PACKAGE_NAME) TEXT("<id> registry key, and the service will accept\n")
+                        TEXT("   requests on \\\\.\\pipe\\") TEXT(PACKAGE) TEXT("<id>\\service named pipe.\n"));
 
                 return 0;
             }
src/openvpnserv/service.h +3 -2
index 6b559a5..da20433 100644
@@ -37,9 +37,10 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <tchar.h>
+#include "../tapctl/basic.h"
 
-#define APPNAME  TEXT(PACKAGE "serv")
-#define SERVICE_DEPENDENCIES  TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"
+#define APPNAME  TEXT(PACKAGE) TEXT("serv")
+#define SERVICE_DEPENDENCIES  TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0")
 
 /*
  * Message handling
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: openvpnserv: Fix some inconsistent usages of TEXT()

I have looked a bit at the patch and it seems reasonable. Lev has looked harder and understands Windows, so that ACK is what counts ;-) - also we have a mingw buildbot now, confirming that this isn't breaking windows builds.

Your patch has been applied to the master branch.

commit 02412106f406538db6f84fdea223b0972a3e3f41

Author: Frank Lichtenheld
Date:   Mon Jan 27 10:11:02 2025 +0100
     openvpnserv: Fix some inconsistent usages of TEXT()

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg30603.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/851?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by stipa

Change subject: openvpnserv: Fix some inconsistent usages of TEXT()
......................................................................

openvpnserv: Fix some inconsistent usages of TEXT()

In general you can't use multiple strings as argument to TEXT() since it just adds a L in front of the argument. So if you specifiy multiple arguments the later argument strings do not get the L.

This does not seem to directly cause problems with our ASCII strings, but make the usage consistent with all the other code. That will help in case we remove the usage of TEXT().

Also include tapctl/basic.h in openvpnserv to make the macro environment consistent with tapctl and openvpnmsica.

Change-Id Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30603.html

---
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/common.c
M src/openvpnserv/interactive.c
M src/openvpnserv/service.c
M src/openvpnserv/service.h

5 files changed, 13 insertions(+), 11 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/851/2

src/openvpnserv/CMakeLists.txt +1 -0
index 154e17c..ff03867 100644
@@ -17,6 +17,7 @@
     interactive.c
     service.c service.h
     validate.c validate.h
+    ../tapctl/basic.h
     ../openvpn/wfp_block.c ../openvpn/wfp_block.h
     openvpnserv_resources.rc
     ../openvpn/ring_buffer.h
src/openvpnserv/common.c +2 -2
index 61a7296..a88a724 100644
@@ -45,7 +45,7 @@
     if (status != ERROR_SUCCESS)
     {
         SetLastError(status);
-        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_instance, value);
+        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), service_instance, value);
     }
 
     return ERROR_SUCCESS;
@@ -63,7 +63,7 @@
     TCHAR install_path[MAX_PATH];
     TCHAR default_value[MAX_PATH];
 
-    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\" PACKAGE_NAME "%ls"), service_instance);
+    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls"), service_instance);
 
     LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ, &key);
     if (status != ERROR_SUCCESS)
src/openvpnserv/interactive.c +5 -5
index 67f5bbc..35753b7 100644
@@ -60,9 +60,9 @@
 
 openvpn_service_t interactive_service = {
     interactive,
-    TEXT(PACKAGE_NAME "ServiceInteractive"),
-    TEXT(PACKAGE_NAME " Interactive Service"),
-    TEXT(SERVICE_DEPENDENCIES),
+    TEXT(PACKAGE_NAME) TEXT("ServiceInteractive"),
+    TEXT(PACKAGE_NAME) TEXT(" Interactive Service"),
+    SERVICE_DEPENDENCIES,
     SERVICE_AUTO_START
 };
 
@@ -1973,7 +1973,7 @@
     }
 
     swprintf(ovpn_pipe_name, _countof(ovpn_pipe_name),
-             TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), service_instance, GetCurrentThreadId());
+             TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service_%lu"), service_instance, GetCurrentThreadId());
     ovpn_pipe = CreateNamedPipe(ovpn_pipe_name,
                                 PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
                                 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 1, 128, 128, 0, NULL);
@@ -2173,7 +2173,7 @@
     }
 
     TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */
-    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service"), service_instance);
+    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service"), service_instance);
     HANDLE pipe = CreateNamedPipe(pipe_name, flags,
                                   PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS,
                                   PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa);
src/openvpnserv/service.c +2 -2
index a71f5c6..054fc5f 100644
@@ -282,8 +282,8 @@
                 wprintf(TEXT("-instance interactive <id>\n")
                         TEXT("   Runs the service as an alternate instance.\n")
                         TEXT("   The service settings will be loaded from\n")
-                        TEXT("   HKLM\\Software\\" PACKAGE_NAME "<id> registry key, and the service will accept\n")
-                        TEXT("   requests on \\\\.\\pipe\\" PACKAGE "<id>\\service named pipe.\n"));
+                        TEXT("   HKLM\\Software\\") TEXT(PACKAGE_NAME) TEXT("<id> registry key, and the service will accept\n")
+                        TEXT("   requests on \\\\.\\pipe\\") TEXT(PACKAGE) TEXT("<id>\\service named pipe.\n"));
 
                 return 0;
             }
src/openvpnserv/service.h +3 -2
index 6b559a5..da20433 100644
@@ -37,9 +37,10 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <tchar.h>
+#include "../tapctl/basic.h"
 
-#define APPNAME  TEXT(PACKAGE "serv")
-#define SERVICE_DEPENDENCIES  TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"
+#define APPNAME  TEXT(PACKAGE) TEXT("serv")
+#define SERVICE_DEPENDENCIES  TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0")
 
 /*
  * Message handling

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/851?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3
Gerrit-Change-Number: 851
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/851?usp=email )

Change subject: openvpnserv: Fix some inconsistent usages of TEXT()
......................................................................

openvpnserv: Fix some inconsistent usages of TEXT()

In general you can't use multiple strings as argument to TEXT() since it just adds a L in front of the argument. So if you specifiy multiple arguments the later argument strings do not get the L.

This does not seem to directly cause problems with our ASCII strings, but make the usage consistent with all the other code. That will help in case we remove the usage of TEXT().

Also include tapctl/basic.h in openvpnserv to make the macro environment consistent with tapctl and openvpnmsica.

Change-Id Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30603.html

---
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/common.c
M src/openvpnserv/interactive.c
M src/openvpnserv/service.c
M src/openvpnserv/service.h

5 files changed, 13 insertions(+), 11 deletions(-)
src/openvpnserv/CMakeLists.txt +1 -0
index 154e17c..ff03867 100644
@@ -17,6 +17,7 @@
     interactive.c
     service.c service.h
     validate.c validate.h
+    ../tapctl/basic.h
     ../openvpn/wfp_block.c ../openvpn/wfp_block.h
     openvpnserv_resources.rc
     ../openvpn/ring_buffer.h
src/openvpnserv/common.c +2 -2
index 61a7296..a88a724 100644
@@ -45,7 +45,7 @@
     if (status != ERROR_SUCCESS)
     {
         SetLastError(status);
-        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_instance, value);
+        return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), service_instance, value);
     }
 
     return ERROR_SUCCESS;
@@ -63,7 +63,7 @@
     TCHAR install_path[MAX_PATH];
     TCHAR default_value[MAX_PATH];
 
-    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\" PACKAGE_NAME "%ls"), service_instance);
+    swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls"), service_instance);
 
     LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ, &key);
     if (status != ERROR_SUCCESS)
src/openvpnserv/interactive.c +5 -5
index 67f5bbc..35753b7 100644
@@ -60,9 +60,9 @@
 
 openvpn_service_t interactive_service = {
     interactive,
-    TEXT(PACKAGE_NAME "ServiceInteractive"),
-    TEXT(PACKAGE_NAME " Interactive Service"),
-    TEXT(SERVICE_DEPENDENCIES),
+    TEXT(PACKAGE_NAME) TEXT("ServiceInteractive"),
+    TEXT(PACKAGE_NAME) TEXT(" Interactive Service"),
+    SERVICE_DEPENDENCIES,
     SERVICE_AUTO_START
 };
 
@@ -1973,7 +1973,7 @@
     }
 
     swprintf(ovpn_pipe_name, _countof(ovpn_pipe_name),
-             TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), service_instance, GetCurrentThreadId());
+             TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service_%lu"), service_instance, GetCurrentThreadId());
     ovpn_pipe = CreateNamedPipe(ovpn_pipe_name,
                                 PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED,
                                 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 1, 128, 128, 0, NULL);
@@ -2173,7 +2173,7 @@
     }
 
     TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */
-    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service"), service_instance);
+    swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service"), service_instance);
     HANDLE pipe = CreateNamedPipe(pipe_name, flags,
                                   PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS,
                                   PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa);
src/openvpnserv/service.c +2 -2
index a71f5c6..054fc5f 100644
@@ -282,8 +282,8 @@
                 wprintf(TEXT("-instance interactive <id>\n")
                         TEXT("   Runs the service as an alternate instance.\n")
                         TEXT("   The service settings will be loaded from\n")
-                        TEXT("   HKLM\\Software\\" PACKAGE_NAME "<id> registry key, and the service will accept\n")
-                        TEXT("   requests on \\\\.\\pipe\\" PACKAGE "<id>\\service named pipe.\n"));
+                        TEXT("   HKLM\\Software\\") TEXT(PACKAGE_NAME) TEXT("<id> registry key, and the service will accept\n")
+                        TEXT("   requests on \\\\.\\pipe\\") TEXT(PACKAGE) TEXT("<id>\\service named pipe.\n"));
 
                 return 0;
             }
src/openvpnserv/service.h +3 -2
index 6b559a5..da20433 100644
@@ -37,9 +37,10 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <tchar.h>
+#include "../tapctl/basic.h"
 
-#define APPNAME  TEXT(PACKAGE "serv")
-#define SERVICE_DEPENDENCIES  TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"
+#define APPNAME  TEXT(PACKAGE) TEXT("serv")
+#define SERVICE_DEPENDENCIES  TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0")
 
 /*
  * Message handling

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/851?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3
Gerrit-Change-Number: 851
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged